<template>
	<view class="content">
		<view class="header">
			<view class="userinfo" @click="goInfo" v-if="userId">
				<image class="head" :src="personalList.avatar" v-if="personalList.avatar"></image>
				<image class="head" src="/static/head_default.png" v-else></image>
				<view class="name">{{personalList.realname?personalList.realname : personalList.username}}</view>
				<!-- <view class="info">部门：{{getDefaultValue(personalList.depart)}}  
					职位：{{getDefaultValue(personalList.post)}}</view> -->
					<view class="info">{{ personalList.phone }}</view>
			</view>
			<view class="userinfo" @click="goLogin" v-else>
				<image class="head" src="/static/head_default.png"></image>
				<view class="name">点击登录</view>
				<view class="info">您当前未登录，请先登录或注册</view>
			</view>
			<uni-icons @click="goSetting" type="gear" size="30" color="white"
				style="position: absolute;top: 10px;right: 10px;" v-if="userId"></uni-icons>
		</view>
		<uni-row class="top-menu" v-if="userId">
			
		</uni-row>
		
	<!-- 	<view class="nav">
			<view class="nav-item">
				<view class="nav-btn">历史足迹></view>
				<view class="nav-num">89<text class="nav-u">条</text></view>
			</view>
			<view class="nav-item">
				<view class="nav-btn">智能推荐></view>
				<view class="nav-num">15<text class="nav-u">项</text></view>
			</view>
		</view>
		
		<view class="p-menu">
			<view class="p-menu-title">服务与功能</view>
			<view class="menu">
				<view class="line">
					<view class="menu-item">
						<uni-icons type="camera" :size="30" color="#333" class="menu-icon menu-icon-bg2"/>
						<view class="text">热门活动</view>
					</view>
					<view class="menu-item">
						<uni-icons type="wallet" :size="30" color="#333" class="menu-icon menu-icon-bg3"/>
						<view class="text">新手入门</view>
					</view>
					<view class="menu-item">
						<uni-icons type="calendar" :size="30" color="#333" class="menu-icon menu-icon-bg2"/>
						<view class="text">精选内容</view>
					</view>
					<view class="menu-item">
						<uni-icons type="headphones" :size="30" color="#333" class="menu-icon menu-icon-bg1"/>
						<view class="text">客服中心</view>
					</view>
				</view>
				<view class="line">
					<view class="menu-item">
						<uni-icons type="color" :size="30" color="#333" class="menu-icon menu-icon-bg2"/>
						<view class="text">邀请好友</view>
					</view>
					<view class="menu-item">
						<uni-icons type="gift" :size="30" color="#333" class="menu-icon menu-icon-bg5"/>
						<view class="text">反馈评价</view>
					</view>
					<view class="menu-item">
						<uni-icons type="help" :size="30" color="#333" class="menu-icon menu-icon-bg6"/>
						<view class="text">常见问题</view>
					</view>
					<view class="menu-item">
						<uni-icons type="staff" :size="30" color="#333" class="menu-icon menu-icon-bg2"/>
						<view class="text">关于我们</view>
					</view>
				</view>
			</view>
		</view> -->
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				personalList:{
				  avatar:'',
				  realname:'',
				  username:'',
				  post:'',
				  depart:'',
					phone: ''
				},
				userId: undefined
			}
		},
		onShow:function(){
			this.load();
		},
		onPullDownRefresh() {
			this.load();
		},
		methods: {
			getDefaultValue(val){
				return val ? val : '未设置';
			},
			goPage(url){
				uni.navigateTo({
					url: url
				});
			},
			goSetting() {
				this.goPage('/pages/profile/setting/setting');
			},
			goInfo(){
				this.goPage('/pages/profile/edit/edit');
			},
			goLogin(){
				this.goPage('/pages/profile/login/login');
			},
			load() {
			},
		}
	}
</script>

<style lang="scss" scoped>
	body {
		background-color: #f1f1f1;
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		.top-menu {
			background-color: white;
			width: 95%;
			text-align: center;
			margin-top: -40px;
			border-radius: 5px;
			box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.1);
			-moz-box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.1);
			-webkit-box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.1);

			.top-menu-item {
				padding: 20px;
				.svg-icon{
					margin: 5rpx 0 5rpx;
				}
				.name {
					font-size: 12px;
				}
			}
		}

		.header {
			background: linear-gradient(to top, #ffffff, #4caf50);  
			width: 100%;
			height: 400rpx;
			color: white;

			.userinfo {
				margin-top: 100rpx;
				margin-left: 20rpx;

				.name {
					margin-left: 180rpx;
					font-size: 34rpx;
					padding-top: 30rpx;
				}

				.info {
					margin-left: 90px;
					font-size: 24rpx;
					margin-top: 8px;
				}

				.head {
					width: 70px;
					height: 70px;
					border-radius: 70px;
					float: left;
					border: 5px solid rgba(220, 220, 255, 0.2);
				}
			}
		}
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
	.nav{
		margin: 30rpx 0;
		width: calc(100vw - 40rpx);
		display: flex;
		flex-wrap: wrap;
		flex-direction: row;
		align-content: space-between;
		justify-content: space-between;
		.nav-item{
			flex: 0 0 49%;
			text-align: left;
			font-size: 24rpx;
			padding: 36rpx 0;
			border-radius: 10rpx;
			.nav-btn{
				float: right;
				margin-right: 20rpx;
				border-radius: 30rpx;
				padding: 10rpx 20rpx;
			}
			.nav-num{
				margin-left: 40rpx;
				font-size: 40rpx;
				font-weight: bold;
				margin-top: -2rpx;
				.nav-u{
					font-size: 28rpx;
					margin-left: 10rpx;
					font-weight: normal;
				}
			}
		}
		.nav-item:nth-child(odd){
			background-color: #DDE3FB;
			.nav-btn{
				background-color: #B8C1FA;
				color: #595D9E;
				font-weight: bold;
			}
			.nav-num{
				color: #595D9E;
			}
		}
		.nav-item:nth-child(even){
			background-color: #CFF3EF;
			.nav-btn{
				background-color: #8CD7DA;
				color: #3C7473;
				font-weight: bold;
			}
			.nav-num{
				color: #3C7473;
			}
		}
	}
	.p-menu{
		width: calc(100vw - 40rpx);
		margin: 0 20rpx;
		text-align: left;
		background-color: white;
		border-radius: 10rpx;
		.p-menu-title{
			font-size: 34rpx;
			font-weight: 600;
			color: #222;
			margin: 20rpx 0;
			padding-left: 20rpx;
		}
		.menu{
			border-radius: 10rpx;
			overflow: hidden;
			position: relative;
			padding-top: 20rpx;
			.line{
				display: flex;
				flex-wrap: wrap;
				margin-bottom: 40rpx;
				.menu-item{
					flex: 0 0 25%;
					text-align: center;
					font-size: 24rpx;
					padding: 10rpx 0;
					color: #666;
					.menu-icon{
						padding: 8rpx;
						border-radius: 30rpx;
					}
					.text{
						margin-top: 10rpx;
					}
				}
			}
		}
	}
</style>